﻿<!DOCTYPE html>
<html>
<head>
    <title>JS Operators Exercise 8</title>
    <link href="styles/js-console.css" rel="stylesheet" />
</head>
<body>
    <h1>Calculates trapezoid's area by given sides a and b and height h:</h1>
    <div>
        <label for="size-a">A:</label>
        <input type="number" id="size-a"/>
    </div>
    <div>
        <label for="size-b">B:</label>
        <input type="number" id="size-b"/>
    </div>
    <div>
        <label for="size-h">H:</label>
        <input type="number" id="size-h"/>
    </div>
    <button onclick="calculate()">Calculate</button>
    <div id="js-console"></div>
    <script src="scripts/js-console.js"></script>
    <script>
        function calculate()
        {
            var sizeA;
            var sizeB;
            var sizeH;

            sizeA = jsConsole.readInteger("#size-a");
            sizeB = jsConsole.readInteger("#size-b");
            sizeH = jsConsole.readInteger("#size-h");

            jsConsole.writeLine("trapezoid's area is " + (sizeH * (sizeA + sizeB) / 2));
        }
    </script>
</body>
</html>
